<?php

class CHCPlotDataLabels extends AbstractHCObject
{
    /**
     * Enable or disable the data labels. 
     * 
     * Defaults to false.
     * 
     * @param $pbBoolean
     */
    public function setEnabled($pbBoolean=false)
    {
        if (CSDebug::assertBoolean($pbBoolean)) return false;
        
        $this->setParam('enabled', $pbBoolean);
    }
    
    
    /**
     * Callback JavaScript function to format the data label. 
     * 
     * Available data are: 
     * this.x: The x value.
     * this.y: The y value.
     * this.series: The series object. The series name is available through this.series.name.
     * this.point: The point object. The point name, if defined, is available through this.point.name.
     * 
     * Default value:
     * 		formatter: function() 
     * 		{
     * 			return this.y;
     * 		}
     * 
     * @param $psJSString
     */
    public function setFormatter($psJSString)
    {
        if (CSDebug::assertString($psJSString)) return false;
        
        $this->setParam('formatter', $this->tokenize($psJSString));
    }
    
    /**
     * The x position offset of the label relative to the point. 
     * 
     * Defaults to 0.
     * 
     * @param unknown_type $pnInteger
     */
    public function setX($pnInteger=0)
    {
        if (CSDebug::assertInteger($pnInteger)) return false;
        
        $this->setParam('x', $pnInteger);
    }
    
    
    /**
     * The y position offset of the label relative to the point. 
     * 
     * Defaults to -6.
     * 
     * @param $pnInteger
     */
    public function setY($pnInteger=-6)
    {
        if (CSDebug::assertInteger($pnInteger)) return false;
        
        $this->setParam('y', $pnInteger);
    }
    
    
    /**
     *  What part of the string the given position is anchored to. 
     *  Can be one of "left", "center" or "right". 
     *  In inverted charts, x axis label alignment and y axis alignment are swapped. 
     *  
     *  Defaults to "center".
     *  
     * @param unknown_type $psString
     */
    public function setAlign($psString='center')
    {
        if (!in_array($psString, array('left', 'center', 'right'))) return false;
        
        $this->setParam('align', $psString);
    }

    
    /**
     *  Rotation of the labels in degrees. 
     *  
     *  Defaults to 0.
     *  
     * @param $pnInteger
     */
    public function setRotation($pnInteger=0)
    {
        if (CSDebug::assertInteger($pnInteger, true)) return false;
        
        $this->setParam('rotation', $pnInteger);
    }

    
    /**
     * CSS styles for the label. Defaults to:
     * 
     * array
     * (
     * 		color: '#666',
     * 		font: '10px bold "Lucida Grande", "Lucida Sans Unicode"," Verdana, Arial, Helvetica, sans-serif"
     * );
     * 
     * @param $pasArray
     */
    public function setStyle($pasArray)
    {
        if (CSDebug::assertArray($pasArray)) return false;
        
        $this->setParam('style', $pasArray);
    }
}

?>